package Features;

import core.Document;


public class FeatureSentencePosition extends Feature{
	
	public FeatureSentencePosition(String argumento) {
		activo = argumento.toLowerCase().contains("spos");
	}
	
	public void extract(Document doc){
		if(activo==false) 
			return;
		for(int i=0; i<doc.sentenceList.length; i++){
			doc.sentenceList[i].featureVector+= " "+extractSentence(i, doc.sentenceList.length);
		}
	}
		
	public String extractSentence(int numFrase, int totalFrases){
		int tercoTexto=(totalFrases/3); 
		
		if(tercoTexto<=1)
			return "0";
		if(numFrase<=tercoTexto)
			return "1";
		else{
			if(numFrase>(totalFrases-tercoTexto))
				return "3";
			else
				return "2";
		}
	}

}
